/*
 * Root
 * 
 * v1.0
 *
 * 11/24/2014
 * 
 * Copyright Richard R. Cachero Jr.
 */
package patchy;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.ArrayList;

public class Root implements Serializable {
    private ArrayList<Event> events = new ArrayList<>();
    private ArrayList<Course> courses = new ArrayList<>();
    private Archive archive = new Archive();

    /**
     * @return the events
     */
    public ArrayList<Event> getEvents() {
        return events;
    }

    /**
     * @param events the events to set
     */
    public void setEvents(ArrayList<Event> events) {
        this.events = events;
    }

    /**
     * @return the courses
     */
    public ArrayList<Course> getCourses() {
        return courses;
    }

    /**
     * @param courses the courses to set
     */
    public void setCourses(ArrayList<Course> courses) {
        this.courses = courses;
    }

    /**
     * @return the archive
     */
    public Archive getArchive() {
        return archive;
    }

    /**
     * @param archive the archive to set
     */
    public void setArchive(Archive archive) {
        this.archive = archive;
    }
    
    public Root inputData() {
        ObjectInputStream fileReader = null;
        Root r = new Root();
        try {
            fileReader = new ObjectInputStream(
                            new FileInputStream("patchy.dat"));
            r = (Root)fileReader.readObject();
        } catch (FileNotFoundException fnfe) {
                            fnfe.printStackTrace();
        } catch (Exception e) {
                            e.printStackTrace();
        }
        return r;
    }
}
